<!-- 横版大图，商品卡片 -->
<template>
	<block>
		<view class="index-content-title">
			<view class="">
				{{dataObj.name || '--'}}
			</view>
			<view class="index-content-all" v-if="isShow" @click="goAllHref(dataObj.name)">
				全部
			</view>
		</view>
		<view class="index-content-img-box">
			<view class="index-content-img" :class="className" v-for="(item,index) in dataObj.list" :key="index" @click="$Router.push({ path: '/pages/goods/detail', query: { id: item.id } })">
				<image :src="item.image" mode="widthFix" :lazy-load="true" @click="goHref(item,dataObj.name)"></image>
				<view class="index-content-word">
					<view class="index-content-img-title u-ellipsis-1">
						{{item.title}}
					</view>
					<view class="index-content-img-subtitle u-ellipsis-1" >
						{{item.subtitle}}
					</view>
					<view class="index-content-img-price" v-if="item.price">
						{{item.price}} <span>{{item.original_price}}</span>
					</view>
				</view>
			</view>
		</view>
	</block>
</template>

<script>
	/**
	 *shoproGoodsCard - 商品列表卡片
	 * @property {Object} detail - 商品详情
	 * @property {String} type - 商品类型
	 * @property {String} image - 商品图片
	 * @property {String} title - 商品标题
	 * @property {String} subtitle - 商品副标题
	 * @property {String | Number} price - 商品价格
	 * @property {String | Number} originPrice - 商品原价
	 * @property {String | Number} sales - 商品销量
	 * @property {Array} tagTextList - 活动标签
	 * @event {Function} click 商品被点击
	 */
	export default {
		components: {},
		data() {
			return {
				goodsInfo: {}, //商品详情
			};
		},
		computed: {
		},
		props: {
			dataObj: {
				type: Object,
				default: () => {
					return {};
				}
			},
			className:{
				type: String,
				default: ''
			},
			isShow:{
				type: Boolean,
				default: true
			},
		},
		mounted() {},
		created() {
			console.log(this.className)
		},
		methods: {
			goHref(item,name){
				let showType = this.dataObj.name === '融资专区' || this.dataObj.name === '项目专区' ?'1':'0'
				if(showType === '1'){
					this.$Router.push({ path: '/pages/iconpage/detail', query: { id: item.id,showType:showType } })
				}else{
					this.$Router.push({ path: '/pages/goods/detail', query: { id: item.id,showType:showType } })
				}
				
			},
			goAllHref(name){
				const mapName = {
					'教育专区':'education',
					'产品专区':'product',
					'项目专区':'project',
				}
				let setName = mapName[name]
				uni.navigateTo({
					url:'pages/iconpage/list'+'?name='+setName,
				})
			}
		}
	};
</script>

<style lang="scss">
	.index-content-img-box{
		.index-content-left{
			display: flex;
			justify-content: flex-start;
			width: 100%;
			image{
				width: 132rpx;
				height: 132rpx;
				margin-right: 30rpx;
				border-radius: 30rpx;
			}
			.index-content-word{
				padding: 10rpx 0 0;
				.index-content-img-title{
					margin-bottom: 20rpx;
				}
			}
			.index-content-img-price{
				display: none;
			}
		}
		.index-content-left:last-child{
			margin-bottom: 0;
		}
		.index-content-fin{
			width: 196rpx;
			image{
				width: 100%;
				height: 228rpx;
				border-radius: 30rpx;
			}
			.index-content-word{
				display: none;
			}
		}
		.index-content-pro{
			width: 300rpx;
			.index-content-word{
				padding-bottom: 0;
				.index-content-img-title{
					margin-bottom: 20rpx;
				}
			}
			image{
				height: 300rpx;
			}
			.index-content-img-price{
				display: none;
			}
		}
	}
</style>
